package bundle;

import java.util.*;

import transport.*;

public class BundleLayer {

	public static String myID;
	public static BundleHandler handler;
	public static BundleStorage warehouse;
	static Timer storeCheck;
	
	public static synchronized void cleanBundleStorage(){
		warehouse.clean();
	}
	
	public static void init(String id, String server){
		TransportLayer.init(id, server);
        myID = TransportLayer.myID;
        handler = new BundleHandler();
        new Thread(handler).start();
        warehouse = new BundleStorage();
        storeCheck = new Timer();
        storeCheck.schedule(new BundleStoreCheck(), 20000, 3600*1000);
	}
	
}
